package com.dkd.model.auth.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dkd.model.auth.VO.UserVO;
import com.dkd.model.auth.entity.SysUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysUserMapper extends BaseMapper<SysUser> {

	List<SysUser> selectPageListBySql(UserVO userVO);

	//不过滤查询条件
	@Select(" select t.* " +
			" from sys_user t " +
			" where 1=1 " +
			" and t.username like '%'||#{username}||'%' " +
			" and t.password like #{password} " +
			"")
	List<SysUser> selectListBySQL(@Param("username") String username, @Param("password") String password);

	//过滤查询条件
	@Select(" <script> " +
			" select t.* " +
			" from sys_user t " +
			" where 1=1 " +
			" <if test='username != null'> " +
			" and t.username like '%'||#{username}||'%' " +
			" </if> " +
			" <if test='password != null'> " +
			" and t.password like #{password} " +
			" </if> " +
			" </script> ")
	List<SysUser> selectListBySQL(UserVO userVO);

}
